﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataTransferObject;

namespace _5ChickDeal.UserControl
{
    public partial class AllDealMenu : System.Web.UI.UserControl
    {
        DataClassesDataContext db;
        protected void Page_Load(object sender, EventArgs e)
        {
            db = new DataClassesDataContext();

            var deals = from d in db.Deals
                        select new
                        {
                            id = d.id,
                            ten = d.ten,
                            hinh = d.HinhAnhs.FirstOrDefault().ten,
                            gia = d.gia,
                            giaconlai = d.giaconlai,
                            giam = 100-(int)(((float)d.giaconlai / d.gia) * 100),


                        };
            DataListDeal.DataSource = deals;
            DataListDeal.DataBind();
        }

       
    }
}